{extend name="public/base"}
{block name='main'}
<form class="layui-form layui-form-pane" action=""  method="post" style="padding:20px;">
    <div class="layui-form-item">
        <label class="layui-form-label">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" id="title" placeholder="请输入" class="layui-input" value="{$info.title|default=''}">
        </div>
    </div>

    <div class="layui-form-item" id="ad_code">
        <label class="layui-form-label">接收人</label>
        <div class="layui-input-block">
            <textarea name="to_name" id="to_name" class="layui-textarea" placeholder="会员名中间用半角逗号,隔开，不填则为全部会员"></textarea>
        </div>
    </div>

    <div class="layui-form-item" id="ad_code">
        <label class="layui-form-label">信息内容</label>
        <div class="layui-input-block">
            <textarea name="info" id="info" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="upbtn">发送通知</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use(['layer','jquery','form','upload'], function () {
        // 操作对象
        var layer = layui.layer,$ = layui.jquery,form = layui.form, upload = layui.upload;

        // 提交
        // 提交
        form.on('submit(upbtn)', function (data) {
            // 提交到方法 默认为本身
            $.post("{:url('user_mail/save')}",data.field,function(res){
                if(res.status ==  1){
                    layer.msg(res.msg,{time:1800},function(){
                        //关闭弹层后刷新父页面
                        // window.parent.location.reload();
                        // var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        // parent.layer.close(index);
                    });
                }else{
                    layer.msg(res.msg,{time:1800},function(){
                        //关闭弹层后刷新父页面
                        // window.parent.location.reload();
                        // var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        // parent.layer.close(index);
                    });
                }
            });
            return false;
        });





    });
</script>
{/block}